﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KL.Store.Core.Domain;
using TN.Data;

namespace KL.Store.Data
{
    public class dbPayment
    {
        #region Insert

        public static void Insert(string PaymentId, int UserId, DateTime CreateDate, string Status, short PaymentType, decimal Amount, decimal TotalAmount, int PosId, short Installment, short CargoId, short AddressId, short InvoiceId, string OrderId, string ClientIp, string Detail)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_Payment_Insert", new object[] { PaymentId, UserId, CreateDate, Status, PaymentType, Amount, TotalAmount, PosId, Installment, CargoId, AddressId, InvoiceId, OrderId, ClientIp, Detail });
        }

        #endregion

        #region Update

        public static void Update(string PaymentId, string Status, string Detail)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_Payment_Update", new object[] { PaymentId, Status, Detail });
        }

        #endregion

        #region Delete

        public static void Delete(string PaymentId)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_Payment_Delete", new object[] { PaymentId });
        }

        #endregion

        #region Get

        public static Payment Get(string PaymentId)
        {
            IList<Payment> objectList = new List<Payment>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_Payment_Get", objectList, new object[] { PaymentId });
            return objectList.FirstOrDefault();
        }

        #endregion

        #region GetList

        public static IList<Payment> GetList(int UserId)
        {
            IList<Payment> objectList = new List<Payment>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_Payment_List", objectList, new object[] { UserId });

            return objectList;
        }

        #endregion
    }
}
